# Maintainer: Felix Yan <felixonmars@archlinux.org>

_npmname=emojione
pkgname=nodejs-$_npmname
pkgver=4.5.0
pkgrel=3
pkgdesc="A complete set of emojis designed for the web"
arch=('any')
url="https://www.emojione.com"
license=('MIT')
depends=('nodejs')
makedepends=('npm')
source=("https://registry.npmjs.org/$_npmname/-/$_npmname-$pkgver.tgz")
noextract=($_npmname-$pkgver.tgz)
sha512sums=('4eae796375203ce9dac850cdf9077a40c3f4ae9a07d746b59e1485376eecf205d6deaca6805207897cacd84098600235df805a7e6237a8ff678b6ad939ef418c')

package() {
  npm install -g --user root --prefix "$pkgdir"/usr "$srcdir"/$_npmname-$pkgver.tgz
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  ln -s "../../../lib/node_modules/$_npmname/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/"

  # Fix permissions
  find "$pkgdir/usr" -type d -exec chmod 755 '{}' +

  # npm gives ownership of ALL FILES to build user
  # https://bugs.archlinux.org/task/63396
  chown -R root:root "${pkgdir}"
}
